import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

// 组件
import { AdminComponent } from './admin.component';
import { AuthGuardService } from '../auth';
import { AdminDashboardComponent } from './admin-dashboard.component';
import { EventlistenComponent, EventlistenAddComponent, EventlistenEditComponent } from './client/eventlisten';
import { EventComponent, EventHookComponent } from './client/event';
// 路由配置
const adminRoutes: Routes = [
    {
        path: '',
        component: AdminComponent,
        canActivate: [AuthGuardService],
        children: [
            { path: '', component: AdminDashboardComponent },
            {
                path: 'client', children: [

                    {
                        path: 'eventlisten', children: [
                            { path: '', component: EventlistenComponent },
                            { path: 'add', component: EventlistenAddComponent },
                            { path: 'edit', component: EventlistenEditComponent }
                        ]
                    },
                    {
                        path: 'event', children: [
                            { path: '', component: EventComponent },
                            { path: 'hook/:id', component: EventHookComponent }
                        ]
                    }
                ]
            }
        ]
    }
];

@NgModule({
    imports: [
        RouterModule.forChild(adminRoutes)
    ],
    exports: [
        RouterModule
    ]
})
export class AdminRoutingModule { }
